package com.huawei.gamebox.service.common.cardkit.card;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout.LayoutParams;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.gamebox.service.common.cardkit.bean.BannerEntryCardBean;
import com.huawei.gamebox.service.common.cardkit.bean.MultiEntriesCardBean;
import java.util.Collections;
import o.azb;
import o.cgz;
import o.chy;
import o.ContentManager;
import o.epv;
import o.eqx;
import o.evx;
import o.exp$a;
import o.exp.d;

public class LeavesEntranceCard extends BaseGsCard {
    private ImageView ˋ = null;
    private ImageView ˎ = null;

    public LeavesEntranceCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ˊˋ = view;
        this.ˋ = (ImageView) view.findViewById(d.ॱᐝ);
        this.ˎ = (ImageView) view.findViewById(d.ᐝॱ);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        int i;
        Context ˋ = ContentManager.getInstant().getContext();
        int ॱ = (azb.ॱ(ˋ) - ((azb.ˊ(ˋ) + azb.ˏ(ˋ)) + ˋ.getResources().getDimensionPixelSize(exp$a.ʽॱ))) / 2;
        boolean z = !epv.ʼ(ˋ);
        if (z) {
            i = (int) (((float) ॱ) / 3.75f);
        } else {
            i = (int) (((float) ॱ) / 2.0f);
        }
        ˋ(this.ˋ, ॱ, i);
        ˋ(this.ˎ, ॱ, i);
        MultiEntriesCardBean multiEntriesCardBean = (MultiEntriesCardBean) cardBean;
        if (multiEntriesCardBean.ˊ() != null && multiEntriesCardBean.ˊ().size() > 0) {
            Collections.sort(multiEntriesCardBean.ˊ());
            BannerEntryCardBean bannerEntryCardBean = (BannerEntryCardBean) multiEntriesCardBean.ˊ().get(0);
            bannerEntryCardBean.ˋˋ(multiEntriesCardBean.ॱˉ());
            ॱ(this.ˋ, bannerEntryCardBean, z);
            if (multiEntriesCardBean.ˊ().size() >= 2) {
                bannerEntryCardBean = (BannerEntryCardBean) multiEntriesCardBean.ˊ().get(1);
                bannerEntryCardBean.ˋˋ(multiEntriesCardBean.ॱˉ());
                ॱ(this.ˎ, bannerEntryCardBean, z);
            }
        }
    }

    private void ॱ(ImageView imageView, BannerEntryCardBean bannerEntryCardBean, boolean z) {
        imageView.setTag(bannerEntryCardBean);
        if (z) {
            eqx.ˎ(imageView, bannerEntryCardBean.ˑॱ());
        } else {
            eqx.ˎ(imageView, bannerEntryCardBean.ॱˌ());
        }
    }

    private void ˋ(View view, int i, int i2) {
        LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
        if (layoutParams == null) {
            view.setLayoutParams(new LayoutParams(i, i2));
            return;
        }
        layoutParams.width = i;
        layoutParams.height = i2;
    }

    public void ॱ(chy o_chy) {
        OnClickListener anonymousClass3 = new evx(this) {
            final /* synthetic */ LeavesEntranceCard ˊ;

            {
                this.ˊ = r1;
            }

            public void ˋ(View view) {
                this.ˊ.ʽ().onClick(view);
            }
        };
        this.ˋ.setOnClickListener(anonymousClass3);
        this.ˎ.setOnClickListener(anonymousClass3);
    }
}
